//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//#include <Registry.h>
#include "registry.hpp"

//include TRegistry
 

//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------


void __fastcall TForm1::Button2Click(TObject *Sender)
{
  TRegistry *MyRegistry =new TRegistry();
  MyRegistry->RootKey = HKEY_LOCAL_MACHINE;
  if(MyRegistry->OpenKey("Software\\Microsoft\\Windows\\CurrentVersion\\Run",false))
  {

    String str = MyRegistry->ReadString(Edit2->Text);
    if(str=="")
    {
      ShowMessage("üڣ");
      return;
    }
    Edit3->Text = str;
    MyRegistry->CloseKey();
  }
  else ShowMessage("ܴ򿪣");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
  TRegistry *MyRegistry =new TRegistry();
  MyRegistry->RootKey = HKEY_LOCAL_MACHINE;
  if(MyRegistry->OpenKey("Software\\Microsoft\\Windows\\CurrentVersion\\Run",false))
  {
    MyRegistry->WriteString(Edit4->Text, Edit5->Text);
    MyRegistry->CloseKey();
  }
  else ShowMessage("ܴ򿪣");
}
//---------------------------------------------------------------------------
